﻿import com.dinmax.factorium.*

class FactoriumPaisaje 
extends MovieClip {
	
	private var INIT_X:Number; 
	private var INIT_Y:Number; 
	private var MAX_SCALE:Number = 100;
	private var MIN_SCALE:Number = 55;
	private var SCALE_DIVISOR:Number = 5;
	
	//elementos que están dibujados
	private var mcCielo:FactoriumCielo;
	private var mcShadow:MovieClip;
	
	public function init():Void {
		trace("FactoriumPaisaje init()");
		this.INIT_X = 888/2;
		this.INIT_Y = 576/2;
		FactoriumApp.getApp().setPaisaje(this);
		this.initPosition();
		return;
	};
	
	function onLoad():Void {
		this.init();
		return;
	};
	
	private function initPosition():Void {
		this._x = this.INIT_X;
		this._y = this.INIT_Y;
		return;
	}
	public function zoomIn():Void {
		var nScale:Number = this.MIN_SCALE;
		var finalScale:Number = this.MAX_SCALE;
		var divisor:Number = this.SCALE_DIVISOR;
		this.onEnterFrame = function():Void {
			if(this._xscale >= finalScale){
				delete this.onEnterFrame;
			} else {
				this._xscale = nScale + (finalScale - this._xscale)/ divisor;
				this._yscale = this._xscale;
				
				nScale = this._xscale;
			}
			return;
		}
		return;
	}
	
	public function zoomOut():Void {

		var nScale:Number = this.MAX_SCALE;
		var finalScale:Number = this.MIN_SCALE;
		var divisor:Number = this.SCALE_DIVISOR;
		this.onEnterFrame = function():Void {
			if(this._xscale <= finalScale){
				delete this.onEnterFrame;0
			} else {
				this._xscale = nScale - (this._xscale - finalScale)/ divisor;
				this._yscale = this._xscale;
				
				nScale = this._xscale;
			}
			return;
		}
		return;
	}
	
}